local lingdongshenxing = fk.CreateSkill{
    name = "ym2__lingdongshenxing",
}
local U = require "packages/utility/utility"
Fk:loadTranslationTable{
    ["ym2__lingdongshenxing"] = "灵动身形",
    [":ym2__lingdongshenxing"] = "当你使用或打出红色牌后，你可获得X张【影】，然后若你的手牌数大于体力上限，本轮此技能失效（X为你本回合发动此技能的次数）。",
    ["#ym2__lingdongshenxing-ask"] = "灵动身形：是否获得%arg张【影】？（若获得后手牌数大于体力上限，本轮本技能失效）。",

    ["$ym2__lingdongshenxing1"] = " ",
    ["$ym2__lingdongshenxing2"] = " ",
}
local spec = {
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(lingdongshenxing.name) and data.card.color == Card.Red
    end,
    on_cost = function(self, event, target, player, data)
        local x = player:usedSkillTimes(lingdongshenxing.name, Player.HistoryTurn) + 1
        return player.room:askToSkillInvoke(player,{
            skill_name = lingdongshenxing.name,
            prompt = "#ym2__lingdongshenxing-ask:::"..U.ConvertNumber(x)
        })
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local x = player:usedSkillTimes(lingdongshenxing.name, Player.HistoryTurn) 
        local get = {}
        local name = "shade"
        --[[if Fk.all_card_types["shade"] then
            name = "shade"
        elseif Fk.all_card_types["rfenghou__shade"] then
            name = "rfenghou__shade"
        end
        assert(name, "服务器未加入【影】！请联系管理员安装“江山如故”或“封侯”包")]]--
        for i = 1, x, 1 do
            table.insert(get, room:printCard(name, 1, 1).id)
        end
        room:obtainCard(player, get, true, fk.ReasonJustMove, player.id, lingdongshenxing.name, MarkEnum.DestructIntoDiscard)
        if player:getHandcardNum() > player.maxHp then
            room:invalidateSkill(player, lingdongshenxing.name, "-round")
        end
    end,
}
lingdongshenxing:addEffect(fk.AfterCardUseDeclared,spec)
lingdongshenxing:addEffect(fk.CardResponding,spec)
return lingdongshenxing